"""
@File    :   out.py
@Time    :   2024/04/13 16:40:58
@Author  :   Qrj
@Email   :   923207736@qq.com
@description   :   字典数据相关的pydantic序列化模型
"""

from datetime import datetime

from pydantic import BaseModel, Field, TypeAdapter

from src.schemas.out import BaseOutSchemaConfigMixin


class DictDataCompleteOutSchema(BaseModel, BaseOutSchemaConfigMixin):
    """字典数据完整的序列化模型"""

    id: int = Field(default=..., description="主键")
    label: str = Field(default=..., description="数据标签")
    value: str = Field(default=..., description="数据键值")
    color_type: str = Field(default=..., description="颜色类型")
    css_class: str = Field(default=..., description="css class")
    status: bool = Field(default=..., description="状态")
    remark: str = Field(default=..., description="备注")
    show_order: int = Field(default=..., description="显示顺序")
    create_datetime: datetime = Field(default=..., description="创建时间")
    update_datetime: datetime = Field(default=..., description="修改时间")
    creator_username: str = Field(default=..., description="创建者")
    updater_username: str = Field(default=..., description="修改者")
    dict_type: str = Field(default=..., description="字典类型")


# 字典数据完整的列表序列化模型
ListDictDataCompleteOutSchema = TypeAdapter(list[DictDataCompleteOutSchema])


class DictDataSimpleOutSchema(BaseModel, BaseOutSchemaConfigMixin):
    """字典数据简单的序列化模型"""

    id: int = Field(default=..., description="主键")
    label: str = Field(default=..., description="数据标签")
    value: str = Field(default=..., description="数据键值")
    color_type: str = Field(default=..., description="颜色类型")
    css_class: str = Field(default=..., description="css class")
    show_order: int = Field(default=..., description="显示顺序")
    dict_type: str = Field(default=..., description="字典类型")
    status: bool = Field(default=..., description="状态")


# 字典数据简单的列表序列化模型
ListDictDataSimpleOutSchema = TypeAdapter(list[DictDataSimpleOutSchema])
